import re
s='http://bbs.csdn.net/topics/390185494/recommend'
patt = 'http://bbs.csdn.net/topics/[A-Za-z0-9]+/recommend'
re.match(patt, s)

def get_re_patt(str1):
    str1=str1.replace('*','\*')
    str1=str1.replace('^','\^')
    str1=str1.replace('$','\$')
    str1=str1.replace('+','\+')
    str1=str1.replace('?','\?')
    str1=str1.replace('[','\[')
    str1=str1.replace(']','\]')
    str1=str1.replace('{','\{')
    str1=str1.replace('}','\}')
    str1=str1.replace('|','\|')
    str1=str1.replace('(','\(')
    str1=str1.replace(')','\)')
    str1=str1.replace('.','\.')
    return str1

S_csdn_allow_domains=[#'http://forum.csdn.net/',
                        #'http://www.blog.51cto.com/blogcommend/',
                       ]
S_csdn_deny_domains=['http://my.csdn.net',                                      ##
                    'http://hi.csdn.net',
                    'http://download.csdn.net',
                    'http://d.download.csdn.net',
                    'http://passport.csdn.net',
                    'http://student.csdn.net/link.php',
                    'http://job.csdn.net',
                    'http://hui.csdn.net',
                    'http://so.csdn.net',
                    'http://search.csdn.net',
                    'http://live.csdn.net',
                    'http://write.blog.csdn.net',
                    'http://writeblog.csdn.net',
                    'http://www.csdn.net/csdn/csdnClick.aspx',
                    'http://forum.csdn.net/PointForum/UserCard.ashx',
                    'http://forum.csdn.net/PointForum/UserCard.aspx',
                    'http://forum.csdn.net/PointForum/BuildTopic.aspx',
                    'http://forum.csdn.net/PointForum/Manage/Tops/InsertTop.aspx',
                    'http://forum.csdn.net/PointForum/Manage/SetPrime.aspx',
                    'http://forum.csdn.net/PointForum/Manage/SetNotPrime.aspx',
                    'http://forum.csdn.net/PointForum/Manage/LockTopic.aspx',
                    'http://forum.csdn.net/PointForum/Manage/UnlockTopic.aspx',
                    'http://forum.csdn.net/PointForum/Manage/MoveTopic.aspx',
                    'http://forum.csdn.net/PointForum/Manage/ModifyTopic.aspx',
                    'http://forum.csdn.net/PointForum/Manage/DeleteTopic.aspx',
                    'http://forum.csdn.net/PointForum/Forum/TopicAddPoint.aspx',
                    'http://forum.csdn.net/PointForum/Manage/TitleStyle.aspx',
                    'http://forum.csdn.net/PointForum/Manage/RemoveTitleStyle.aspx',
                    'http://forum.csdn.net/PointForum/Manage/TopicManageView.aspx',
                    'http://forum.csdn.net/PointForum/Forum/PostTopic.aspx',
                    'http://forum.csdn.net/PointForum/Manage/ModifyReply.aspx',
                    'http://forum.csdn.net/PointForum/Manage/DeleteReply.aspx',
                    'http://forum.csdn.net/PointForum/Forum/EstimateReply.aspx',
                    'http://forum.csdn.net/PointForum/Manage/Tops/deleteTop.aspx',
                    'http://forum.csdn.net/PointForum/Forum/ReplyT.aspx',
                    'http://www.csdn.net/Develop/Read_Article.asp',
                    'http://community.csdn.net/Expert/TopicView.asp',
                    'http://forum.csdn.net/PointForum/Forum/UserTopicList.aspx',
                    'http://community.csdn.net/History/UserHistoryTopicList.aspx',
                    'cto.csdn.net',
                    #'http://bbs.csdn.net/posts/',
                    'csdn.net/posts/',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/edit',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/destroy_edit',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/add_point',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/highlight',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/top',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/recommend',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/lock',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/move',
                    'http://bbs.csdn.net/topics/[A-Za-z0-9]+/close',
                    ]
deny_url_list=S_csdn_deny_domains
allow_url_list=S_csdn_allow_domains
url='http://bbs.csdn.net/topics/220011298/edit'
for d_url in deny_url_list:
    patt = d_url.lower()
    #patt = get_re_patt( patt )
    if re.search(patt, url):
        print True
print 'end'



